# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libva
pkgver=2.21.0
pkgrel=0
pkgdesc="Video Acceleration (VA) API for Linux"
url="https://01.org/linuxmedia"
arch="all"
options="!check"  # No test suite.
license="MIT"
depends_dev="libx11-dev libxext-dev libxfixes-dev libdrm-dev"
makedepends="$depends_dev meson wayland-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/intel/libva/archive/$pkgver.tar.gz"

prepare() {
	( if [ -f "$startdir"/../libva-glx/APKBUILD ]; then
		_v=$pkgver
		. "$startdir"/../libva-glx/APKBUILD
		if [ "$_v" != "$pkgver" ]; then
			die "libva and libva-glx needs to be same version"
		fi
	fi )
	default_prepare
}

build() {
	abuild-meson \
		-Db_lto=true \
		-Dwith_glx=no \
		-Dwith_wayland=yes \
		builddir
	meson compile -C builddir
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C builddir
}

sha512sums="
93654bb892e0e269d7682a1344fe6f7298432d1f2b347396c63aa1bd84ac0f707af34950a93098fe86a9bc8986fc9f97f75f0f15d8495ffd2caf8cf0eed9612c  libva-2.21.0.tar.gz
"
